package com.ebelter.btcomlib.views;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ebelter.btcomlib.R;
import com.ebelter.btcomlib.models.bluetooth.bean.SleepUnit;
import com.ebelter.btcomlib.utils.ViewUtils;

import java.util.List;


/**
 * 组合控件11 不知道怎么起名字了 还是按序号来吧
 */

public class CombinView11 extends LinearLayout{
    public CombinView11(Context context) {
        this(context,null);
    }


    public CombinView11(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }


    public CombinView11(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(getContext());
        initDatas();

    }

    private void initDatas() {

    }

    public void setTitle(int index,String title){
        if (index==1){
            ViewUtils.setTextViewStr(textView1,title);
        }else if (index==2){
            ViewUtils.setTextViewStr(textView2,title);
        }else if (index==3){
            ViewUtils.setTextViewStr(textView3,title);
        }else if (index==4){
            ViewUtils.setTextViewStr(textView4,title);
        }
    }






    private TextView textView1;
    private TextView textView2;
    private TextView textView3;
    private TextView textView4;
    private  LineBar lineBar;



    private LinearLayout root;



    private void initView(Context context) {
        View view =  View.inflate(context, R.layout.cb11_layout, this);//把那个布局当做是自己的孩子
        root = view.findViewById(R.id.cb11_root_ll);
        textView1=view.findViewById(R.id.cb11_t1);
        textView2=view.findViewById(R.id.cb11_t2);
        textView3=view.findViewById(R.id.cb11_t3);
        textView4=view.findViewById(R.id.cb11_t4);
        lineBar=view.findViewById(R.id.cb11_lineBar);

    }

    public void setDatas(List<SleepUnit> datas){
        if (lineBar!=null)lineBar.setDatas(datas);
    }

}
